package test.y2019.november;

import cn.hutool.core.lang.Console;
import common.base.BaseService;

import java.util.concurrent.locks.ReentrantLock;

/**
 * Created By  醉美柳舞之众星捧月
 *
 * @author song
 * @date 2019/11/22 13:49
 */
public class November7 extends BaseService {

    public static void main(String[] args) {

        new November8().start();
        Console.error("异步线程===========>>>>>>>>>>> 行数开始");
        executorService.execute(November7::first);
        executorService.execute(November7::second);
        Console.error("异步线程===========>>>>>>>>>>> 行数结束");

    }

    private static final Integer MAX_SIZE = 10;

    private static void first() {
        common();
    }

    private static void second() {
        common();
    }

    private static void common() {
        ReentrantLock lock = new ReentrantLock();
        System.out.println("完全不晓得.....这个可重入锁咋个搞............!!!!!");
        synchronized (MAX_SIZE) {
            for (int i = 0; i <= MAX_SIZE; i++) {
                Thread s = Thread.currentThread();
                try {
                    Thread.sleep(0);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                Console.error(i + " => " + s.getName());
            }
        }
    }
}
